import request from "../utils/request";
import api from "./index";

export function queryTenantList() {
  return request({
    url: api.queryTenantList,
    method: "post",
  })
}

export function queryTenantsByKey(key){
  const data = {
    queryStr : key
  }
  return request({
    url: api.queryTenantsByKey,
    method: "post",
    data
  })
}

export function createTenant(data) {
  return request({
    url: api.createTenant,
    method: "post",
    data
  })
}

export function modifyTenantInfo(data) {
  return request({
    url: api.modifyTenantInfo,
    method: "post",
    data
  })
}

export function removeTenantByName(name){
  const data = {
    username: name
  }
  return request({
    url: api.removeTenantByName,
    method: "post",
    data
  })
}

export function modifyTenantStatus(tenantId, tenantName, targetStatus) {
  const data = {
    id: tenantId,
    username: tenantName,
    status: targetStatus
  }
  return request({
    url: api.modifyTenantStatus,
    method: "post",
    data
  })
}

export function modifyUserStatus(userId, userName, targetStatus){
  const data = {
    id: userId,
    username: userName,
    status: targetStatus
  }
  return request({
    url: api.modifyUserStatus,
    method: "post",
    data
  })
}

export function modifyAnswerStatus(answerId, answerName, targetStatus){
  const data = {
    id: answerId,
    username: answerName,
    status: targetStatus
  }
  return request({
    url: api.modifyAnswerStatus,
    method: "post",
    data
  })
}

export function queryChargeByKey(key) {
  const data = {
    keyword: key
  }
  return request({
    url: api.queryChargeByKey,
    method: "post",
    data
  })
}

export function queryAnswererByKey(key) {
  const data = {
    keyword: key
  }
  return request({
    url: api.queryAnswererByKey,
    method: "post",
    data
  })
}

export function queryUsersByKey(key){
  const data = {
    keyword: key
  }
  return request({
    url: api.queryUsersByKey,
    method: "post",
    data
  })
}
